package com.yanqu.road.server.manager.tomb.service;

import com.google.protobuf.AbstractMessage;
import com.google.protobuf.InvalidProtocolBufferException;
import com.yanqu.road.pb.syncMessage.SyncMessage;
import com.yanqu.road.pb.tomb.Tomb;
import com.yanqu.road.server.command.ICrossServiceCommand;
import com.yanqu.road.server.manager.tomb.TombServiceMgr;

import java.util.concurrent.CompletableFuture;


//进入主界面发送个人信息进行用户信息的初始化或更新
public class TombActivityInfoServiceCmd implements ICrossServiceCommand {

    @Override
    public CompletableFuture<AbstractMessage.Builder<?>> execute(SyncMessage.Request request, int activityId, int groupId) throws InvalidProtocolBufferException {
        Tomb.TombActivityInfoToCrossReq req =Tomb.TombActivityInfoToCrossReq.parseFrom(request.getDataBytes());
        CompletableFuture<AbstractMessage.Builder<?>> completableFuture = new CompletableFuture<>();
        completableFuture.complete(TombServiceMgr.updateDbUserInfo(request.getActivityId(),request.getSenderId(),request.getRawServerId(),req));
        return completableFuture;
    }
}
